﻿using System.Windows;
using System.Windows.Input;
using Opds_Viewer.Model;

namespace Opds_Viewer.Control
{
    /// <summary>
    /// Interaction logic for AddCatalogBox.xaml
    /// </summary>
    public partial class AddCatalogBox : Window
    {
        private MyCatalog _newCatalog;

        public AddCatalogBox(ref MyCatalog newCatalog)
        {
            InitializeComponent();
            _newCatalog = newCatalog;
        }

        private void OnCanExecute(object sender, CanExecuteRoutedEventArgs e)
        {
            e.CanExecute = true;
        }

        private void OnExecute(object sender, ExecutedRoutedEventArgs e)
        {
            _newCatalog = new MyCatalog();
            _newCatalog.Name = tbName.Text;
            _newCatalog.UrlIndex = tbName.Text;
            _newCatalog.Status = false;
            _newCatalog.Save();
        }
    }
}
